package com.itmk.business.product.service.Impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itmk.business.product.entity.ProductCategory;
import com.itmk.business.product.entity.PurchasingPrice;
import com.itmk.business.product.mapper.ProductMapper;
import com.itmk.business.product.mapper.PurchasingPriceMapper;
import com.itmk.business.product.service.PurchasingPriceService;
import com.itmk.vo.req.ProductReqVO;
import com.itmk.vo.resp.PurchasingPriceRespVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PurchasingPriceServiceImpl extends
        ServiceImpl<PurchasingPriceMapper, PurchasingPrice> implements PurchasingPriceService {
    @Autowired
    private PurchasingPriceMapper purchasingPriceMapper;

    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<Object> getPriceList(ProductReqVO vo) {
//        先清除临时表中的分级目录树的数据
        this.productMapper.truncateTable();
        return this.purchasingPriceMapper.getpriceListsByProcedure(vo);
    }

    @Override
    public PurchasingPriceRespVO getPriceDetailById(Long id) {
        return this.purchasingPriceMapper.getDetailPriceById(id);
    }
}
